// pages/tutorial/tutorial.js
const app = getApp()
const API = require("../../http/API")
const http = require("../../http/http")
Page({

    /**
     * 页面的初始数据
     */
    data: {
        material: "",
        groupList: "",
        height: false,
        clickId: "",
        pageNum: 1,
    },
    filtrateClick() {
        if (this.data.height) {
            this.setData({
                height: false
            })
        } else {
            this.setData({
                height: true
            })
        }

    },
    /**
     * 生命周期函数--监听页面加载
     */
    textBlueId(e) {
        // console.log(e);
        this.setData({
            clickId: e.currentTarget.dataset.color
        })
    },
    clickall() {
        this.setData({
            clickId: ""
        })
    },
    seriesCom(obj) {
        http(API.series, obj).then(res => {
            console.log(res);
        })
    },
   
    onLoad(options) {
        // 搜索列表
        http(API.series).then(res => {
            console.log(res.data.data);
            this.setData({
                material: res.data.data
            })
        })
        // 更多筛选
        http(API.courseGroupList).then(res => {
            // console.log(res.data.course_subjects);
            this.setData({
                groupList: res.data.course_subjects
            })
        })
    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom(){
        this.setData({
            pageNum:this.data.pageNum += 1
        })
        http(API.video,{
            type:1,
            page:this.data.pageNum,
            limit:10
        }).then(res => {
       
            this.setData({
                material:[...this.data.material,...res.data.data] 
            })
        })
    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage() {

    }
})